import axios from "axios"
export let setName = (data = "zhaoermazi")=>{ // 如果没有传参，走默认参数，如果传了参数，还是走传的参数
    return {
        type:"setname",
        payload:data
    }
}
export let getList = ()=>{ // 处理异步和同步得写法不一样，异步返回得是一个函数
    return (dispatch)=>{
        axios.get("/list").then(res=>{
            dispatch({
                type:"getlist",
                payload:res.data
            })
        })
    }
}
export let setaGE = (aaa)=>{
    return {
        type:"setage",
        payload:aaa
    }
}
